<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <style type="text/css">
        body,
        p {
            margin: 0;
            padding: 0;
        }
        
        html,
        body {
            height: 100%;
        }
        
        div {
            width: 400px;
            margin: 20px auto;
            border: 3px black solid;
            padding: 8px;
        }
        
        div p {
            text-indent: 34px;
        }
    </style>

</head>

<body>
    <div>
        <p>方东升方东升方东升</p>
    </div>

    <div>
        <p>安馨萍方东升方东升安馨萍</p>
    </div>

    <div>
        <p>方东升安馨萍</p>
    </div>

    <div>
        <p>方东升安馨萍方东升</p>
    </div>
</body>

</html>
<script>
    var axp = document.querySelectorAll("div");
    for (var i = 0; i < axp.length; i++) {
        axp[i].onclick = function() {
            var fds = this.children[0].innerHTML;
            alert(fds);
            // console.log(11111)
        }
    }
</script>